package com.example.presentshopping.ui.custom

import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.FrameLayout
import com.example.presentshopping.R
import kotlinx.android.synthetic.main.layout_sigin.view.*

open class SkyNumrLayout @JvmOverloads constructor(
    context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr) {

    var anInt = 0

    init {
        View.inflate(context, R.layout.layout_sigin, this)
        setDivideLine()
    }

    fun setDivideLine() {
        when (anInt) {
            1 -> ivs_sjien1.setImageResource(R.drawable.ic_qiadao12)
            2 -> {
                ivs_sjien1.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien2.setImageResource(R.drawable.ic_qiadao12)
            }
            3 -> {
                ivs_sjien1.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien2.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien3.setImageResource(R.drawable.ic_qiadao12)
            }
            4 -> {
                ivs_sjien1.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien2.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien3.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien4.setImageResource(R.drawable.ic_qiadao12)
            }
            5 -> {
                ivs_sjien1.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien2.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien3.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien4.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien5.setImageResource(R.drawable.ic_qiadao12)
            }
            6 -> {
                ivs_sjien1.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien2.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien3.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien4.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien5.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien6.setImageResource(R.drawable.ic_qiadao12)
            }
            7 -> {
                ivs_sjien1.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien2.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien3.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien4.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien5.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien6.setImageResource(R.drawable.ic_qiadao12)
                ivs_sjien7.setImageResource(R.drawable.ic_qiandao23)
            }
        }
    }


     open   fun setanInt(init: Int) {
            this.anInt = init
           setDivideLine()
        }


}
